<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>

<head>
    <base href="${pageContext.request.contextPath}/"/>
    <title>襄阳蓝芯智能化办公系统</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="view/bootstrap-3.3.5/css/bootstrap.css"/>
    <link rel="stylesheet" type="text/css" href="view/bootstrapvalidator/css/bootstrapValidator.css"/>
    <script charset="utf-8" src="view/jquery/jquery-1.10.2.min.js"></script>
    <script charset="utf-8" src="view/bootstrap-3.3.5/js/bootstrap.js"></script>
    <script charset="utf-8" src="view/bootstrapvalidator/js/bootstrapValidator.js"></script>

</head>
<body>


<div class="panel panel-primary">
    <div class="panel-heading">
        <h4 class="panel-title">编辑报销类型信息</h4>
    </div>

    <div class="panel-body">
        <form action="expense/AddBxInfo" id="myform" method="post"
              class="form-horizontal" role="form">
            <div class="col-md-12">
                <div class="form-group col-md-6">
                    <label for="name" class="col-md-4 control-label">报销类型名称</label>
                    <div class="col-md-8">
                        <input type="hidden" id="oid" name="oid" value="${bxInfor.oid }">
                        <input type="text" id="name" name="name"
                               class="form-control" placeholder="请输入报销类型名称"
                               value="${bxInfor.name}">
                    </div>
                </div>
            </div>

            <div class="col-md-12">
                <div class="form-group col-md-6">
                    <label for="isActice" class="col-md-4 control-label">报销类型状态</label>
                    <div class="col-md-8">
                        <input type="radio" name="isActice" ${bxInfor.isActice=="1"?"checked":"" } value="1">启用
                        &nbsp;&nbsp;&nbsp;
                        <input type="radio" name="isActice" ${bxInfor.isActice=="0"?"checked":"" } value="0">禁用
                    </div>
                </div>
            </div>

            <div class="col-md-12">
                <div class="form-group col-md-12">
                    <div class="col-md-10  col-md-offset-2">
                        <a type="button" href="javascript:history.back()" class="btn btn-info">返回</a>
                        <button type="submit" id="editdeptbtn" class="btn btn-success">提交信息</button>
                        <button type="reset" id="resetbtn" class="btn btn-default">取消操作</button>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
</body>
<script type="text/javascript">
    $(document).ready(function () {
        $("#myform").bootstrapValidator({
            message: 'This value is not valid',
            feedbackIcons: {/*input状态样式图片*/
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {
                name: {
                    validators: {
                        notEmpty: {/*非空提示*/
                            message: '报销类型名称不能为空'

                        },
                        stringLength: {
                            min: 2,
                            max: 10,
                            message: '报销类型名称长度需在2-10位'
                        },
                        remote: {
                            url: "expense/checkBxInfoName",
                            delay: 1000,
                            type: 'post',
                            message: '报销类型名称已存在!',
                            data: function (validator) {
                                return {
                                    'name': $("#name").val(),
                                    'oid': $("#oid").val(),
                                };
                            }
                        }
                    }
                },
                isActice: {
                    validators: {
                        notEmpty: {/*非空提示*/
                            message: '请选择报销类型状态'
                        }
                    }
                }
            },
            submitHandler: function (validator, form, submitButton) {
                validator.defaultSubmit();
            }
        });
        $("#resetbtn").click(function () {
            $("#myform").data("bootstrapValidator").resetForm();
        });
    });
</script>
</html>